library(rpart)



lab=read.csv("trainLabels.csv")

col=read.csv("featurefiles/avgcol", header=FALSE)
scol=col[sort.list(col[,1]),]

d=data.frame(lab=lab[1:50000,], red=scol$V3, green=scol$V4, blue=scol$V5)

fit=rpart(lab.label ~ red + green + blue, method="class", data=d)

printcp(fit)
summary(fit)

plot(fit, uniform=TRUE)
text(fit, use.n=TRUE, all=TRUE, cex=.8)

fittet=predict(fit,td, type="vector")

